<include file='public/_meta'>
<title>添加人员列表</title>
<body>

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 智能设备 <span class="c-gray en">&gt;</span> 添加人员列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c" id="search_down"> 添加日期：
		<input type="text" onfocus="WdatePicker({ maxDate:'#F{ $dp.$D(\'datemax\')||\'%y-%M-%d\' }' })" id="datemin" class="input-text Wdate" style="width:100px;">
		-
		<input type="text" onfocus="WdatePicker({ minDate:'#F{ $dp.$D(\'datemin\') }',maxDate:'%y-%M-%d' })" id="datemax" class="input-text Wdate" style="width:100px;">
		<input type="text" class="input-text" style="width:250px" placeholder="车牌、车架、卡号、智能设备号..." id="search_inpute" >
		<span class="select-box" style="width:96px;">
            <select class="select" name="type" id="type" size="1">
                <option value="" style="color: #429842;">安装类型</option>
                <option value="1">新装</option>
                <option value="2">更换</option>
            </select>
        </span>
        <span class="select-box" style="width:100px;">
            <select class="select" id="user_id">
                <option value="" style="color: #429842;">安装人员</option>
                <foreach $data as $value>
                <option value="{$value.id}">{$value.name}</option>
                </foreach>
                
            </select>
        </span>
		<button type="submit" class="btn btn-success radius" id="search_btn"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>		
	</div>
    <div class="cl pd-5 bg-1 bk-gray mt-20"><span class="ml-5"> <a class="btn btn-warning radius" onclick="excel_data_out('导出excel','{:url('index/excell/installUser')}','','310')" href="javascript:;"><i class="Hui-iconfont">&#xe644;</i> 导出EXCEL</a></span>  </div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="40">ID</th>
					<th width="">车牌号</th>
					<th width="">卡号</th>
					<th width="">卡序列号</th>
					<th width="">智能设备号</th>
					<th width="">安装类型</th>
					<th width="">安装人员</th>
					<th width="">安装时间</th>
				</tr>
			</thead>
			<tbody>
				
			</tbody>
		</table>
	</div>
</div>
<!--_footer 作为公共模版分离出去-->
<include file='public/_footer'>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__PUBLIC__/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
$(function(){
	var table = $('.table-sort').DataTable({
		"aaSorting": [[ 0, "desc" ]],//默认第几个排序
		// "bStateSave": true,//状态保存
		 searching: false,
		"aoColumnDefs": [
		  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
		  {"orderable":false,"aTargets":[0,1,2,3,4,5,6]}// 制定列不参与排序
		],
		"bProcessing" : true, //开启读取服务器数据时显示正在加载中……特别是大数据量的时候，开启此功能比较好  
        "bServerSide" : true,//服务器处理分页，默认是false，需要服务器处理，必须true  
        "ajax": {
		    "url": "{:url('index/terminal/installUser')}",
		    "type": "POST",
		    "data":{
		    	'datemin':$('#datemin').val(),
	    		'datemax':$('#datemax').val(),
		    	'search_inpute':$('#search_inpute').val(),
		    	'search_terminal':$('#search_terminal').val(),
		    	'type':$('#type').val(),
		    	'user_id':$('#user_id').val()
		    }
	  	},
	  	displayLength: 10,
	  	columns: [
        { data: 'id' },
        { render:function (data, type, row, meta) {
                if(row.cars){
                    return data = row.cars.car_sn;
                }else{
                    return '未知';
                }
                
            } 
        },
        { render:function (data, type, row, meta) {
                if(row.terminal){
                    return data = row.terminal.cardcode;
                }else{
                    return '未知';
                }
                
            } 
        },
        { render:function (data, type, row, meta) {
                if(row.terminal){
                    return data = row.terminal.sim_id;
                }else{
                    return '未知';
                }
                
            } 
        },
        { render:function (data, type, row, meta) {
                if(row.terminal){
                    return data = row.terminal.equipment_id;
                }else{
                    return '未知';
                }
                
            } 
        },
    	{ render:function (data, type, row, meta) {
                if(row.type == 1){
                    return '新装';
                }else if(row.type == 2){
                    return '更换';
                }else{
                	return '未知';
                }
                
            } 
        },
    	{ render:function (data, type, row, meta) {
                if(row.install_user){
                    return data = row.install_user.name;
                }else{
                    return '未知';
                }
                
            } 
        },
        { data: 'create_time' },

    	],
    	 
	});

	$("#search_btn").click(res=>{
		request();
	});

	$("#search_down").keydown(event=>{
           if (event.which == 13){
				request();
           }
    })

	function request() {
		table.settings()[0].ajax.data = {
	    	'datemin':$('#datemin').val(),
	    	'datemax':$('#datemax').val(),
	    	'search_inpute':$('#search_inpute').val(),
	    	'search_terminal':$('#search_terminal').val(),
	    	'type':$('#type').val(),
	    	'user_id':$('#user_id').val()
		};
	    table.ajax.reload();
	}

});
/*导出*/
function excel_data_out(title,url,w,h) {
    
    layer.confirm('<p class="c-warning">可以选择搜索条件导出</p>',function(index){
     // top.location.href = url;
     let datemin = $('#datemin').val();
     let datemax = $('#datemax').val();
     let type = $('#type').val();
     let user_id = $('#user_id').val();
    let  search_inpute = $('#search_inpute').val();

     window.location.href = url+'?'+'datemin='+datemin+'&datemax='+datemax+'&type='+type+'&user_id='+user_id+'&search_inpute='+search_inpute;

         layer.msg('导出成功,正在下载', {icon: 1});
            
    
    });

}

</script>
</body>
</html>